<?php
include("./config.php");
include("./utils.php");
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>首页</title>
  <?php include 'scripts-inc.php' ?>
  
  <script>
  var userid="<?php echo travelUserid(); ?>";
  $(function(){

    get_page(userid);

    $("#theme-btn").unbind('click').click(function(){
      var theme = getInfo(userid, 1);
      var jsname = "./js/home.js"; 
      if(theme != 0){
        theme = 0;
      } else {
        theme = 1;
        jsname = "./js/theme-"+theme+".js"
      }
      setInfo(userid, 1, theme);
      $.getScript(jsname, function(){
        gen_page(userid);
        $("#theme-text").val(theme);
      }); 
    });

    $("#mode-btn").unbind('click').click(function(){
      var info_id = 2;
      var obj = $("#mode-text");
      var v = obj.val();
      if(v != 0){
        v = 0;
      } else {
        v = 1;
      }
      setInfo(userid, info_id, v);
      gen_page(userid);
      obj.val(v);
    });

    $("#order-btn").unbind('click').click(function(){
      var str_id = 1;
      var v = $("#order-text").val();
      setStr(userid, str_id, v);
      gen_page(userid);
    });

    $("#settings,.settings").unbind('click').click(function() {
      $("#settings-panel").toggleClass("hide");
    });

    $('#settings-panel a').click(function (e) { 
        e.preventDefault();//阻止a链接的跳转行为 
        $(this).tab('show');//显示当前选中的链接及关联的content 
    });

  });//end of $(function(){
  </script>
  <style>
  /*
  #clear{ display: none; position: absolute; width: 16px; height: 16px; margin: 6px 0 0 -20px; background: url(img/clear.png);}
  #clear { padding: 5px; margin: 0; border: 1px solid #beceeb; }
  #clear::-ms-clear { display: none; }
  #clear:valid + .clear { display: inline; }
  */
  </style>
</head>
<body>

<div id="wrapper">
<div id="container">

<div id="nav_data_src">
  <?php include 'navbars-inc.php' ?>
</div>

<div id="settings-panel" class="hide">
  <ul class="nav nav-pills">
    <li class="active"><a href="#tab-mode">模式</a></li> 
    <li><a href="#tab-theme">换肤</a></li> 
    <li><a href="#tab-order">类别顺序</a></li> 
  </ul>

  <div class="tab-content"> 
    <div class="tab-pane active" id="tab-mode">
      <div class="input-group">
        <input type="" class="form-control" id="mode-text" name="tmode" placeholder="顺序，用英文空格分隔">
        <span class="input-group-btn">
          <button class="btn btn-success" type="button" id="mode-btn">保存</button>
        </span>
      </div>
    </div> 
    <div class="tab-pane " id="tab-theme">
      <div class="input-group">
        <input type="" class="form-control" id="theme-text" name="ttheme" placeholder="0/1">
        <span class="input-group-btn">
          <button class="btn btn-success" type="button" id="theme-btn">保存</button>
        </span>
      </div>
    </div> 
    <div class="tab-pane" id="tab-order">
      <div class="input-group">
        <input type="" class="form-control" id="order-text" name="torder" placeholder="0/1">
        <span class="input-group-btn">
          <button class="btn btn-success" type="submit" id="order-btn">保存</button>
        </span>
      </div>
    </div> 
  </div> 
  <button class="btn btn-link settings" type="button">Hide</button>
</div> <!-- settings-panel -->

<div id="search-result">
</div>

<div class="clearfix"></div>
</div><!-- end of search-container -->

<div class="clearfix"></div>

<div id="content" style="margin:auto;">
  <div id="result">
    载入中...
  </div>
  <div class="clearfix"></div>
  <div id="hide-result">
  </div>
</div>

<!-- .................................................... -->
</div><!-- end of container -->
</div><!-- end of wrapper -->
</body>
</html>
